using System;
using System.Collections.Generic;
using System.Text;
using QLNT_DTO;
using System.Data;

namespace QLNT_DAO
{
   public class Thuoc_dao
    {
        public Thuoc_dto[] SelectAll()
        {
            Thuoc_dto[] tdto = new Thuoc_dto[100];
            DataTable dt = new DataTable();
            try
            {
                dt = MyExecute.ExecuteQuery("sp_LayDSThuoc");
                int n = dt.Rows.Count;
                tdto = new Thuoc_dto[n];
                for (int i = 0; i < n; i++)
                {
                    tdto[i] = new Thuoc_dto();
                    tdto[i].MaThuoc = int.Parse(dt.Rows[i]["MaThuoc"].ToString());
                    tdto[i].TenThuoc = dt.Rows[i]["TenThuoc"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return tdto;
        }
    }
}
